<?php
/**
 * User: aka
 * Time: 0:36
 */

namespace app\tenno\model;

use think\Model;

class Other extends Model
{
    public function scopeStuffName($query, $stuffName)
    {
        $query->where('stuff_name', 'like', '%' . $stuffName . '%');
    }

    public function scopeUserFileData($query, $deleteState)
    {
        $query->where('delete_state', '=', $deleteState)
            ->field('delete_time, delete_state',true)
            ->order('update_time','desc')->limit(3);
    }

    public function scopeType($query, $type)
    {
        $query->where('type', '=', $type);
    }

    public function scopeDeleteState($query, $deleteState)
    {
        $query->where('delete_state', '=', $deleteState)
            ->field('delete_time, delete_state',true)
            ->order('unit_price','asc');
    }

    public function scopeIndex($query, $deleteState)
    {
        $query->where('delete_state', '=', $deleteState)
            ->field('delete_time, delete_state',true)
            ->order('update_time','desc');
    }

    public function scopeUid($query, $uid)
    {
        $query->where('uid', '=', $uid);
    }
}